package com.econ.powercloud.ems.common.enums;

/**
 * @Author : zjf
 * @Description : 组合类型枚举
 * @Date : 2022/4/18 16:36
 * @Modified by : zjf
 */
public enum CombinationType implements EnumMethod {

    REAL(1,"实时监控"),
    HIS(2,"历史数据"),
    EXPORT_DEVICE_HIS(3,"导出点号历史数据"),
    ;

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    CombinationType(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static CombinationType fromCode(int code){
        for(CombinationType type: CombinationType.values()){
            if(type.getCode() == code){
                return type;
            }
        }
        return null;
    }

    public static Integer fromDesc(String desc){
        for(CombinationType type: CombinationType.values()){
            if(type.getDesc().equals(desc)){
                return type.getCode();
            }
        }
        return null;
    }
}
